<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
    <div>
啊到沙发上地方大师傅
    </div>

    <script>
        var div = document.getElementsByTagName('div')[0];
        // window.onkeydown = function(){
        //     console.log('按下键盘');
        // }

        // document.onkeydown = function(){
        //     console.log('document键盘');
        // }

        var inputs = document.getElementsByTagName('input')[0];
        // inputs.onkeyup = function(){
        //     console.log('input键盘抬起');
        // }


        inputs.onkeypress = function(){
            console.log('键入内容');
        }



    </script>
</body>
</html>